# -!- coding: utf-8 -!-
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
海拍客存放api接口信息。以dict形式存放，这样就可以API_ALL[''][url]这种方式去取，看起来较直观，知道取得是哪个接口的那部分信息
#文件：inner_api_hipac.py
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

# 当期应还列表
loanRecord = {
    "mchNo":"002647",
    "repayDate":"2020年07月15日",
    "repayRecordDtoList":[
        {
            "billNo":"20200801",
            "interest":105.0,
            "loanAmt":10000.0,
            "loanDate":"2020年07月07日",
            "loanNo":"HIPAC20200708104135423LlhX",
            "overdueFlag":1,                       # 是否逾期，1-逾期
            "penalty":0.0,
            "planId":1,
            "productDesc":"随心还",
            "productNo":"P0001",
            "refundAmt":0.0,
            "repayAmt":10105.0,
            "shouldRepayDate":"2020年08月15日"
        },
        {
            "billNo":None,
            "interest":8.5,
            "loanAmt":1000.0,
            "loanDate":"2020年07月07日",
            "loanNo":"HIPAC20200708104136351GQeG",
            "penalty":2.89,
            "planId":1,
            "productDesc":"分期还",
            "productNo":"P0002",
            "refundAmt":0.0,
            "repayAmt":344.72,
            "shouldRepayDate":"2020年07月15日"
        }
    ],
    "total":4,
    "totalAmt":64422.12
}
# 当期应还还款试算
termRepayTrial ={
    "defaultInterest": 0.0,
    "repayAmt": 60504.0,
    "repayChannel": 0,          # 0-易宝，1-网商
    "repayFee": 504.0,          # 应付费用（分期还手续费+随心还利息）
    "repayNumber": 2,
    "repayPrincipal": 60000.0,  # 总本金
    "trialBillDtoList": [
        {
            "billNo": "202008",
            "loanDateList": [
                "2020年07月12日",
                "2020年07月12日"
            ],
            "loanNoList": [
                "HIPAC202007241406094373dpD",
                "HIPAC2020072414060966816SG"
            ],
            "repayAmt": 60504.0,
            "shouldRepayDay": "202008"
        }
    ],  # 随心还
    "trialLoanDtoList": []      # 分期还
}

# 剩余应还列表
listUnSettledLoan = {
    "code":"0000",
    "data":[
        {
            "loanBillStatus": 3,
            "loanBillStatusDesc": "未出账单",
            "loanDate": "2020年07月12日",
            "loanFee": 85.0,
            "loanNo": "HIPAC202007241406101198K28",
            "orderAmt": 3333.34,                      # 应还本金
            "orderAmtStr": "3333.34元",
            "overDuePenalty": 0.0,
            "overDuePenaltyStr": "0.00元",
            "productDesc": "分期还",
            "productNo": "P0002",
            "refundAmt": 0.0,
            "refundAmtStr": "0.00元",
            "repayTime": "2020年09月15日",
            "shouldRepayAmt": 3418.34,
            "shouldRepayAmtStr": "3418.34元",
            "expendRespList":[
                {
                    "overDueInterest":0.0,
                    "planId":3,
                    "preRepayStatus":1,               # 上一期是否已还（1-已还、0-未还）
                    "refundAmt":0.0,
                    "repayStatus":0,                  # 固定为0-未还
                    "shouldPayFee":85.0,
                    "shouldRepayAmt":3418.34,
                    "shouldRepayDay":"2020年09月15日",
                    "shouldRepayPrincipal":3333.34    # 应还款本金
                }
            ],
        },      # 分期还期数列表
        {
            "billDate": "2020年08月01日",             # 随心还独有
            "billNo": "202008",                      # 随心还独有
            "loanBillStatus": 3,
            "loanBillStatusDesc": "未出账单",
            "loanDate": "2020年08月01日",
            "loanFee": 102.48,
            "orderAmt": 61000.0,                      # 还款本金
            "orderAmtStr": "61000.00元",
            "overDuePenalty": 0.0,
            "overDuePenaltyStr": "0.00元",
            "productDesc": "随心还",
            "productNo": "P0001",
            "refundAmt": 0.0,
            "refundAmtStr": "0.00元",
            "repayTime": "2020年08月15日",
            "shouldRepayAmt": 61102.48,
            "shouldRepayAmtStr": "61102.48元",
            "detailRespList": [
                {
                    "isLoanToday": 2,
                    "loanAmt": 10000.0,               # 借款金额
                    "loanDate": "2020年07月12日",
                    "loanInterest": 16.8,
                    "loanNo": "HIPAC202007241811240923Gu9",
                    "overDueInterest": 0.0,
                    "productName": "随心还",
                    "productNo": "P0001",
                    "refundAmt": 0.0,
                    "repayStatus": 0,
                    "shouldRepayAmt": 10016.8,
                    "shouldRepayDay": "2020年08月01日&2020年08月15日"    # 无用
                },
            ],
        }   # 随心还借据列表
    ],
    "msg":"成功"
}
# 待结清账单详情(随心还)
listUnSettleDetails ={
    "code":"0000",
    "data":[
        {
            "isLoanToday":2,              # 是否当天借款：1-是，2-否 系统日期对比 account.loan_info.local_loan_time时间
            "loanAmt":721.0,              # 借款金额：刚开始借款本金
            "loanDate":"2020-02-19",      # 借款日
            "loanInterest":0.36,          #　应付利息
            "loanNo":"HIPAC202002191910512575nGX",
            "overDueInterest":0.0,        # 逾期罚息
            "productName":"随心还",
            "productNo":"P0001",
            "refundAmt":0.0,              # 总退货金额
            "repayStatus":0,              # 是否可以还款：0-等待还,1-已还款(account.loan_info.status=1)
            "shouldRepayAmt":721.36,      #
            "shouldRepayDay":"2020年03月15日"
        },
        {
            "isLoanToday":2,
            "loanAmt":830.0,
            "loanDate":"2020-02-19",
            "loanInterest":0.0,
            "loanNo":"HIPAC20200219191253083c430",
            "overDueInterest":0.0,
            "productName":"随心还",
            "productNo":"P0001",
            "refundAmt":200.0,
            "repayStatus":0,
            "shouldRepayAmt":830.0,
            "shouldRepayDay":"2020年03月15日"
        }
    ],
    "msg":"成功"
}
# 剩余应还展开(分期还)
listUnSettleExpend = {
    "code":"0000",
    "data":[
        {
            "overDueInterest":0,
            "planId":2,
            "preRepayStatus":1,                  # 前一笔
            "refundAmt":0,
            "repayStatus":0,
            "shouldPayFee":85,
            "shouldRepayAmt":3418.33,
            "shouldRepayDay":"2020年09月15日",
            "shouldRepayPrincipal":3333.33
        },
        {
            "overDueInterest":0,
            "planId":3,
            "preRepayStatus":0,
            "refundAmt":0,
            "repayStatus":0,
            "shouldPayFee":85,
            "shouldRepayAmt":3418.34,
            "shouldRepayDay":"2020年10月15日",
            "shouldRepayPrincipal":3333.34
        }
    ],
    "msg":"成功"
}
# 剩余应还还款试算
repaymentTrial = {
    "code": "0000",
    "msg": "成功",
    "data": {
        "defaultInterest": 0.0,
        "repayAmt": 60027.0,
        "repayChannel": 0,        # 0-易宝，1-网商
        "repayFee": 27.0,
        "repayNumber": 2
    }
}
# 已还款记录
repayRecord = {
    {   "loanNo":"202008",
        "loanTime":"2020年07月22日",
        "productDesc":"随心还",
        "refundTotal":0.0,
        "repayAmtTotal":10042.0,
        "repayFeeTotal":42.0,
        "repayFlag":0,
        "repayInterestTotal":10000.0,
        "repayPenaltyTotal":0.0,
        "repayRecordDetailList":[
            {
                "loanAmt":10000.0,
                "loanNo":"HIPAC20200722154057916fnfz",
                "loanTime":"2020-07-22",
                "planId":1,
                "realRepayDay":"2020-07-22",
                "refundAmt":0.0,
                "repayFee":42.0,
                "repayInterest":10000.0,
                "repayPenalty":0.0,
                "shouldRepayDay":"2020-08-15"
            }
        ]
    },
    {   "loanNo":"HIPAC20200722154058958297p",
        "loanTime":"2020年07月12日",
        "productDesc":"分期还",
        "refundTotal":0.0,
        "repayAmtTotal":684.85,
        "repayFeeTotal":17.0,
        "repayFlag":0,
        "repayInterestTotal":666.66,
        "repayPenaltyTotal":1.19,
        "repayRecordDetailList":[
            {
                "loanAmt":1000.0,
                "loanNo":"HIPAC20200722154058958297p",
                "loanTime":"2020-07-22",
                "planId":1,
                "realRepayDay":"2020-07-22",
                "refundAmt":0.0,
                "repayFee":8.5,
                "repayInterest":333.33,
                "repayPenalty":1.19,
                "shouldRepayDay":"2020-07-15"
            },
            {
                "loanAmt":1000.0,
                "loanNo":"HIPAC20200722154058958297p",
                "loanTime":"2020-07-22",
                "planId":1,
                "realRepayDay":"2020-07-22",
                "refundAmt":0.0,
                "repayFee":8.5,
                "repayInterest":333.33,
                "repayPenalty":0.0,
                "shouldRepayDay":"2020-08-15"
            }
        ]
    }
}

# 授信激活状态
getCreditStatus = {
    "code":"0000",
    "data":{
        "activeDesc":"待激活",
        "activeStatus":0,        # 激活状态：0-未激活
        "applyAmt":50000.0,
        "creditAmt":20000.0,
        "creditDesc":"授信完成",
        "creditStatus":1,        # 授信结果：1-通过
        "mchType":1              # 企业类型：1-企业，0-个体工商户
    },
    "msg":"成功"
}

# 账户基本信息（提额）
getAccountInfo = {
    "available": 100000.00,
    "endDate": "2021-02-22",
    "raiseLimit": 1,           # 1-可提额,0-不可提额
    "used": 0.00
}

# 提额页面展示
raiseLimitApply = {
    "mchNo":"002648",
    "queryCredit":1           # 0-未查询过人行征信申请提额时,1-已查询
}

# 收支记录请求
incomeAndExpenses = {
    "Query":"incomeExpenseType=0&mchNo=002647&tradeMonth=202007",
    "incomeExpenseType":0,      # 0-全部、1-订单支付、2-商城退货、3-还款
    "mchNo":"002647",
    "tradeMonth":"202007"
}
# 收支记录列表
incomeExpenseInfosList ={
        "extLoanNo":"00264720200713174515001",        # 外部订单编号
        "loanNo":"HIPAC20200717174521265d5RG",        # 借据号
        "penaltyFee":0.0,
        "tradeAmt":-10000.0,
        "tradeFee":0.0,
        "tradeMonth":"202007",
        "tradeTime":"2020-07-13 17:45:15",
        "tradeType":0                                # 0-订单支付，1-商城退货，2-
    }
# 易宝银行卡信息推送到账务
bank_card ={
    "accountNo":"HIPACMSXDHIPAC20200928fhH8bQ48FfjK",
    "appNo":"HIPAC",
    "bankCardInfoList":[
        {
            "bankCardNo":"6214832017050921",
            "bankCode":"ICBC",
            "bankMobile":"15917374871",
            "bankName":"工商银行",
            "cardHolder":"曾令为",
            "effect":1,                 # 1-有效，0-无效
            "priority":"2",
            "supportWithhold":"Y"
        },
        {
            "bankCardNo":"6214832017050928",
            "bankCode":"ICBC",
            "bankMobile":"15917374871",
            "bankName":"中国银行",
            "cardHolder":"曾令为",
            "effect":1,
            "priority":"1",
            "supportWithhold":"Y"
        }
    ],
    "idNo":"36242219881103431X",
    "mobile":"15917374871",
    "myBankAccountvalid":1,
    "name":"曾令为",
    "operateFlag":1,               # 授信流程初始绑卡0
    "registerRepayChannel":0,      # 0-易宝
    "shopAddress":"北京市朝阳区曙光西建华1号18层B-2101",
    "shopName":"测试地址一"
}
# 主动还款账务推送消息到业务系统
repay_info={
    "accountNo":"HIPACMSXDHIPAC20200928fhH8bQ48FfjK",
    "amount":3333.34,
    "appNo":"HIPAC",
    "externalRepayNo":"2020092817393411832956711",
    "fee":85.0,
    "loanRemains":0,
    "loanStatus":"FINISHED",
    "penalty":0.0,
    "repayAmount":3418.34,
    "repayPlans":[
        {
            "interestAmount":3333.34,
            "interestFee":85.0,
            "loanNo":"HIPAC202009281619413583FTo",
            "overdueDays":0,
            "overdueFlag":"NORMAL",
            "penaltyFee":0.0,
            "planId":3,
            "repayStatus":"PAID",
            "shouldRepayDate":1607961600000
        }
    ],
    "repayTime":1601285980274,
    "success":True,
    "type":"manualRepay"
}
# 批量扣款随心还账务推送消息到业务系统
repay_info_batch={
    "accountNo":"HIPACMSXDHIPAC20200928fhH8bQ48FfjK",
    "appNo":"HIPAC",
    "extLoanNo":"00264620200927161939002",
    "interestAmount":10000.0,
    "interestFee":75.6,
    "loanAmount":10000.0,
    "loanNo":"HIPAC20200928161941128MdgP",
    "loanRemains":0,
    "loanTime":1601194779000,
    "nextRepayPlanId":1,
    "overdueAmount":0.0,
    "overdueDays":0,
    "penaltyFee":0.0,
    "repayAmount":10075.6,
    "repayMethod":"WITHHOLD",
    "repayPlanId":1,
    "repayPlans":[
        {
            "interestAmount":10000.0,
            "interestFee":75.6,
            "overdueDays":0,
            "overdueFlag":"NORMAL",
            "penaltyFee":0.0,
            "planId":1,
            "repayStatus":"PAID",
            "shouldRepayDate":1602691200000
        }
    ],
    "repayTime":1601284876000,
    "repayType":"NORMAL",
    "shouldRepayDate":1602691200000,
    "status":"FINISHED",
    "type":"repay"
}

hipac_boss = {
    "getApplyInfo":{
        "code":"0000",
        "data":{
            "applyTime":"2020-03-20",
            "authCredit":"/test/meson/test/pdf/creditAuthorizationUnSign/2020-03-20/MSXDHIPAC20200320n6750P28MbF7/loan/MSContractToCm4yJSEG3ygjBUAE.pdf",
            "bizFood":"/test/meson/hipac/picture/personal_info/2020-03-17/living/1584413592957.png",      # 食品经营许可证
            "bizLicense":"/test/meson/hipac/picture/personal_info/2020-03-17/living/1584413585531.png",   # 营业执照
            "directMobile":"13253623222",
            "directName":"我们",
            "directRelation":3,
            "idCardBack":"/test/meson/hipac/picture/personal_info/2020-03-20/living/1584688397180.png",
            "idCardFront":"/test/meson/hipac/picture/personal_info/2020-03-20/living/1584688383950.png",
            "idNo":"36242219881103431X",
            "legal":"测试",
            "living":"/test/meson/hipac/picture/personal_info/2020-03-20/living/1584688484265.png",
            "mchName":"重复5返显",
            "mobile":"15917374871",
            "organCode":"91110105344355489C",
            "othMobile":"13258252366",
            "othName":"哦哟",
            "othRelation":2,
            "processNo":"MSXDHIPAC20200320qkTT1x4r785R"
        },
        "msg":"成功"
    }
}